package com.business_clean.ui.adapter.custom;

import android.view.View;

import com.business_clean.R;
import com.business_clean.data.mode.custom.CustomMangerList;
import com.business_clean.data.mode.project.ProjectMangerList;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import org.jetbrains.annotations.NotNull;

public class CustomMangerAllAdapter extends BaseQuickAdapter<ProjectMangerList, BaseViewHolder> {

    private String uuid = "";

    public CustomMangerAllAdapter() {
        super(R.layout.item_custom_all);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseDataBindingHolder, ProjectMangerList item) {
        baseDataBindingHolder.setText(R.id.tv_item_custom, item.getProject_name())
                .setText(R.id.tv_item_custom_all_name, "立项" + item.getContract_human_num() + "人")
                .setText(R.id.tv_item_custom_in_work, "定岗" + item.getTotal_job_num() + "人")
                .setText(R.id.tv_item_custom_out_work, "在岗" + item.getOn_job_num() + "人");
        if (uuid.equals(item.getUuid())) {
            baseDataBindingHolder.getView(R.id.iv_item_custom_all).setVisibility(View.VISIBLE);
        } else {
            baseDataBindingHolder.getView(R.id.iv_item_custom_all).setVisibility(View.GONE);
        }
        if (getItemPosition(item) == getData().size() - 1) {
            baseDataBindingHolder.getView(R.id.view_item_line).setVisibility(View.INVISIBLE);
        } else {
            baseDataBindingHolder.getView(R.id.view_item_line).setVisibility(View.VISIBLE);
        }
    }

    public void updateChoose(String uuid) {
        this.uuid = uuid;
        notifyDataSetChanged();
    }

}
